﻿using System.Collections.Generic;
using LBoL.Base;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoLEntitySideloader.Attributes;
using ProbeMod.Cards.Template;

namespace ProbeMod.Cards
{
    public sealed class ProbeShieldChargeDef : ProbeCardTemplate
    {
        public override CardConfig MakeConfig()
        {
            CardConfig config = GetCardDefaultConfig();

            config.Rarity = Rarity.Common;
            config.Type = CardType.Defense;
            config.TargetType = TargetType.Nobody;
            config.IsPooled = false;
            

            config.Colors = new List<ManaColor>() { ManaColor.Blue };
            config.Cost = new ManaGroup() { Blue = 1, Any = 1 };

            config.Block = 10;
            config.UpgradedBlock = 12;

            config.Index = CardIndexGenerator.GetUniqueIndex(config);
            return config;
        }
    }

    /// <summary>
    /// 护盾充能
    /// BN 10格挡/护盾  基础牌
    /// </summary>
    [EntityLogic(typeof(ProbeShieldChargeDef))]
    public sealed class ProbeShieldCharge : ProbeCard
    {
        protected override IEnumerable<BattleAction> Actions(UnitSelector selector, ManaGroup consumingMana, Interaction precondition)
        {
            if (IsUpgraded)
            {
                yield return new CastBlockShieldAction(Battle.Player, Battle.Player, 0, Block.Block);
            }
            else
            {
                yield return new CastBlockShieldAction(Battle.Player, Battle.Player, Block.Block, 0);
            }

        }
    }
}
